# from django.contrib import admin
# from users.models import UserProfile
# class UserProfileAdmin(admin.ModelAdmin):
# admin.site.register(UserProfile,UserProfileAdmin)
import xadmin
from xadmin import views
from apps.users.models import EmailVerifyRecord, Banner


class BaseSetting(object):
    """
    设置主题
    """
    enable_themes = False
    use_bootswatch = True


class GlobalSettings(object):
    """
    设置页面样式
    """
    site_title = "在线学习"
    site_footer = "在线学习"
    menu_style = "accordion"


class EmailVerifyRecordAdmin(object):
    """
    EmailVerifyRecord后台管理
    """
    list_filter = ["email", "sendType", "sendTime"]
    search_fields = ['email', 'sendType']
    list_display = ["code", "email", "sendType", "sendTime"]
    ordering = ["-sendTime"]


class BannerAdmin(object):
    """
    Banner后台管理
    refresh_times = [3,5]
    list_editable = []
    exclude = [""]
    model_icon = 'fa fa-user'
    """
    list_filter = ["title", "addTime"]
    search_fields = ["title"]
    list_display = ["title", "addTime", "showBannerInfo"]
    ordering = ["index"]
    readonly_fields = ["addTime"]


xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)
